<template>
    <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="headerUrlPic" label="头像" width="250" />
        <el-table-column prop="nickName" label="昵称" width="280" />
        <el-table-column prop="sexName" label="性别" width="180" />
        <el-table-column prop="titleName" label="头衔" width="280" />
        <el-table-column prop="playedCount" label="游玩场次" width=auto />
    </el-table>
</template>

<script setup>
import { onMounted, ref } from "vue";
import api from "../../utils/api";

let tableData = ref([])


onMounted(() => {
    api.getAlluser().then(res => {
        console.log(res);
        tableData.value = res.data.data

        // 性别中文判断
        for (let i of tableData.value) {
            if (i.sex == 1) {
                i.sexName = '女'
            } else {
                i.sexName = '男'
            }
            i.headerUrlPic = "http://124.220.177.66:8082" + i.headerUrl
        }
        console.log('获取所有用户信息', tableData);
    })
})
</script>